﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;

namespace dreamwork.exam.api.Controllers
{
	[Route("api/[controller]")]
	[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
	[EnableCors("CorsPolicy")]
	public class IdentityController : ControllerBase
	{
		[HttpGet,Route("[action]")]
		public IActionResult GetIdentity()
		{
			return new JsonResult(from c in User.Claims select new { c.Type, c.Value });
		}
	}
}
